package com.thirdgroup.service.impl;

import com.thirdgroup.dao.OrderInfoDao;
import com.thirdgroup.dao.impl.OrderInfoDaoImpl;
import com.thirdgroup.pojo.entity.OrderInfo;
import com.thirdgroup.service.OrderInfoService;
import com.thirdgroup.utils.respond.R;

import java.util.List;

public class OrderInfoServiceImpl implements OrderInfoService {
    private OrderInfoDao orderInfoDao=new OrderInfoDaoImpl();
    @Override
    public R selectByManagerID(String id) {
        List<OrderInfo> orderInfo = orderInfoDao.selectByManagerID(id);
        if (orderInfo != null && !"".equals(orderInfo)) {
            return R.ok(orderInfo);
        }
        System.out.println("系统繁忙，请稍后再试~");
        return R.error(500,"系统繁忙，请稍后再试~");
    }

    @Override
    public R updateState(String id, String status, String date) {
        Integer integer = orderInfoDao.updateState(id, status,date);
        if (integer>=0){
            System.out.println("成功修改"+integer+"条数据！");
            return R.ok("成功修改"+integer+"条数据！");
        }
        System.out.println("系统繁忙，请稍后再试~");
        return R.error(500,"系统繁忙，请稍后再试~");
    }
}
